package aom.ju.ss.utils.http

import android.content.Context
import android.net.ConnectivityManager
import aom.ju.ss.utils.BaseApplication

/**
 * 判断是否有网
 * Created by Administrator on 2017/1/11 0011.
 * 1
 */
object NetWorkUtils {
    val isNetworkConnected: Boolean
        get() {
            val manager = BaseApplication.getInstance()
                    .applicationContext.getSystemService(
                            Context.CONNECTIVITY_SERVICE) as ConnectivityManager
                    ?: return false
            val networkinfo = manager.activeNetworkInfo
            return !(networkinfo == null || !networkinfo.isAvailable)
        }
}